#!/bin/bash
BASE_PATH="."
EXE_FILENAME="myFsDemo"
CMAKE_CONFIG="-DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_EXPORT_COMPILE_COMMANDS=1 -D_FILE_OFFSET_BITS=64"

echo "begin"

cd ${BASE_PATH}/build && cmake .. ${CMAKE_CONFIG} && make

# echo -n "run clang-tidy (y/n)? "
# read clangtidy_choice
# if [ "$clangtidy_choice" != "${clangtidy_choice#[Yy]}" ] ;then
#    ${BASE_PATH}/run-clang-tidy.py -p=${BASE_PATH}/build -fix ${BASE_PATH}
# else
#    echo "no clang-tidy check"
# fi

echo -n "run exe file (y/n)? "
read choice
if [ "$choice" != "${choice#[Yy]}" ] ;then
    ${BASE_PATH}/bin/${EXE_FILENAME}
    echo "you can find executable file in path: ${BASE_PATH}/bin/${EXE_FILENAME}"
else
    echo "you can find executable file in path: ${BASE_PATH}/bin/${EXE_FILENAME}"
fi

echo "end"